package com.vpx.server.controller.system;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;

import com.vpx.server.bean.entity.CProjectFlow;
import com.vpx.server.framework.base.ResultMsg;
import com.vpx.server.service.system.CProjectFlowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
@Api(tags ="项目流程")
@RequestMapping("/api/cProjectFlow")
@RestController
public class CProjectFlowController {
    @Autowired
    private CProjectFlowService service;
    @ApiOperation("添加")
    @GetMapping("/insert")
    public ResultMsg insert(CProjectFlow c){
        c.setId(IdUtil.simpleUUID());
        Date date = DateUtil.date(System.currentTimeMillis());
        c.setCreateTime(date.toString());
        service.insert(c);
        return ResultMsg.success("");
    }
    @ApiOperation("删除")
    @GetMapping("/delete")
    public ResultMsg delete(CProjectFlow  cProjectFlow){
        service.delete(cProjectFlow);
        return ResultMsg.success("");
    }
    @ApiOperation("修改")
    @PostMapping("/update")
    public ResultMsg update(CProjectFlow  cProjectFlow){
        service.update(cProjectFlow);
        return ResultMsg.success("");
    }
    @ApiOperation("查询")
    @GetMapping("/selectAll")
    public ResultMsg selectAll(){

        List<CProjectFlow> list=
                service.selectAll();
        return ResultMsg.success(list);
    }
}
